﻿using Framework;
using Framework.Dependency;
using LinqToYql.Interfaces;
using Microsoft.Practices.Unity;

namespace YQLDataProvider.Providers
{
    public class BaseEconomicDataProvider<TLoader>
        where TLoader : IDataLoader
    {
        private const string SectorsConfigKey = "sectors";
        private const string IndustryConfigKey = "industries";
        private const string QuoteConfigKey = "quotes";
        private const string XchangeConfigKey = "xchangeRates";

        public ISettingsFactory SettingsFactory { get; private set; }

        public IDataLoader DataLoader { get; private set; }

        #region Constant fields access

        public static string SectorsKey
        {
            get { return SectorsConfigKey; }
        }

        public static string IndustryKey
        {
            get { return IndustryConfigKey; }
        }

        public static string QuoteKey
        {
            get { return QuoteConfigKey; }
        }

        public static string XchangeKey
        {
            get { return XchangeConfigKey; }
        }

        #endregion

        public BaseEconomicDataProvider(TLoader dataLoader)
        {
            DataLoader = dataLoader;
            SettingsFactory = DependencyManager.Container.Resolve<ISettingsFactory>();
        }
    }
}
